package work3_9;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Demo6 {
    public static void count(String str) {
        Map map = new HashMap();
        int count ;
        for (int i = 0; i < str.length() ; i++) {
            count = 0;
            char c = str.charAt(i);
            for (int j = 0; j < str.length(); j++) {
                char s = str.charAt(j);
                if(c == s){
                    ++ count;
                }
                map.put(c,count);
            }
        }
        System.out.println(map);
    }
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一串字符：");
        String str = sc.nextLine();
        //分割字符串
//            String[] str1 = str.split("");
        //接受
        System.out.println(str);
        count(str);
    }
}


